<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    function down(x){
        x.style.background="red"
    }
    function press(x){
      x.style.background="blue"
    }
</script>
<body>
    <input type="text" onfocus="down(this)" onblur="press(this)">
    
</body>
</html>
